﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using l1cs.server.model.Instance;
using l1cs.server.serverpackets;
using l1cs.server.datatables;
using l1cs.server.templates;

namespace l1cs.server.model.skill
{
    public class L1SkillStop
    {
        private static Logger _log = Logger.getLogger( typeof( L1SkillStop ).FullName );

        public static void stopSkill( L1Character cha, int skillId )
        {
            if ( skillId == L1SkillId.LIGHT )
            { // ライト
                if ( cha is L1PcInstance )
                {
                    if ( !cha.isInvisble() )
                    {
                        L1PcInstance pc = (L1PcInstance)cha;
                        pc.turnOnOffLight();
                    }
                }
            }
            else if ( skillId == L1SkillId.GLOWING_AURA )
            { // グローウィング オーラ
                cha.addHitup( -5 );
                cha.addBowHitup( -5 );
                cha.addMr( -20 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SPMR( pc ) );
                    pc.sendPackets( new S_SkillIconAura( 113, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.SHINING_AURA )
            { // シャイニング オーラ
                cha.addAc( 8 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconAura( 114, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.BRAVE_AURA )
            { // ブレイブ オーラ
                cha.addDmgup( -5 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconAura( 116, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.SHIELD )
            { // シールド
                cha.addAc( 2 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconShield( 5, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.BLIND_HIDING )
            { // ブラインドハイディング
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.delBlindHiding();
                }
            }
            else if ( skillId == L1SkillId.SHADOW_ARMOR )
            { // シャドウ アーマー
                cha.addAc( 3 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconShield( 3, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.DRESS_DEXTERITY )
            { // ドレス デクスタリティー
                cha.addDex( (sbyte)-2 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_Dexup( pc, 2, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.DRESS_MIGHTY )
            { // ドレス マイティー
                cha.addStr( (sbyte)-2 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_Strup( pc, 2, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.SHADOW_FANG )
            { // シャドウ ファング
                cha.addDmgup( -5 );
            }
            else if ( skillId == L1SkillId.ENCHANT_WEAPON )
            { // エンチャント ウェポン
                cha.addDmgup( -2 );
            }
            else if ( skillId == L1SkillId.BLESSED_ARMOR )
            { // ブレスド アーマー
                cha.addAc( 3 );
            }
            else if ( skillId == L1SkillId.EARTH_BLESS )
            { // アース ブレス
                cha.addAc( 7 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconShield( 7, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.RESIST_MAGIC )
            { // レジスト マジック
                cha.addMr( -10 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SPMR( pc ) );
                }
            }
            else if ( skillId == L1SkillId.CLEAR_MIND )
            { // クリアー マインド
                cha.addWis( (sbyte)-3 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.resetBaseMr();
                }
            }
            else if ( skillId == L1SkillId.RESIST_ELEMENTAL )
            { // レジスト エレメント
                cha.addWind( -10 );
                cha.addWater( -10 );
                cha.addFire( -10 );
                cha.addEarth( -10 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_OwnCharAttrDef( pc ) );
                }
            }
            else if ( skillId == L1SkillId.ELEMENTAL_PROTECTION )
            { // エレメンタルプロテクション
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    int attr = pc.getElfAttr();
                    if ( attr == 1 )
                    {
                        cha.addEarth( -50 );
                    }
                    else if ( attr == 2 )
                    {
                        cha.addFire( -50 );
                    }
                    else if ( attr == 4 )
                    {
                        cha.addWater( -50 );
                    }
                    else if ( attr == 8 )
                    {
                        cha.addWind( -50 );
                    }
                    pc.sendPackets( new S_OwnCharAttrDef( pc ) );
                }
            }
            else if ( skillId == L1SkillId.ELEMENTAL_FALL_DOWN )
            { // エレメンタルフォールダウン
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    int attr = pc.getAddAttrKind();
                    int i = 50;
                    switch ( attr )
                    {
                        case 1:
                            pc.addEarth( i );
                            break;
                        case 2:
                            pc.addFire( i );
                            break;
                        case 4:
                            pc.addWater( i );
                            break;
                        case 8:
                            pc.addWind( i );
                            break;
                        default:
                            break;
                    }
                    pc.setAddAttrKind( 0 );
                    pc.sendPackets( new S_OwnCharAttrDef( pc ) );
                }
                else if ( cha is L1NpcInstance )
                {
                    L1NpcInstance npc = (L1NpcInstance)cha;
                    int attr = npc.getAddAttrKind();
                    int i = 50;
                    switch ( attr )
                    {
                        case 1:
                            npc.addEarth( i );
                            break;
                        case 2:
                            npc.addFire( i );
                            break;
                        case 4:
                            npc.addWater( i );
                            break;
                        case 8:
                            npc.addWind( i );
                            break;
                        default:
                            break;
                    }
                    npc.setAddAttrKind( 0 );
                }
            }
            else if ( skillId == L1SkillId.IRON_SKIN )
            { // アイアン スキン
                cha.addAc( 10 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconShield( 10, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.EARTH_SKIN )
            { // アース スキン
                cha.addAc( 6 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconShield( 6, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.PHYSICAL_ENCHANT_STR )
            { // フィジカル エンチャント：STR
                cha.addStr( (sbyte)-5 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_Strup( pc, 5, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.PHYSICAL_ENCHANT_DEX )
            { // フィジカル エンチャント：DEX
                cha.addDex( (sbyte)-5 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_Dexup( pc, 5, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.FIRE_WEAPON )
            { // ファイアー ウェポン
                cha.addDmgup( -4 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconAura( 147, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.FIRE_BLESS )
            { // ファイアー ブレス
                cha.addDmgup( -4 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconAura( 154, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.BURNING_WEAPON )
            { // バーニング ウェポン
                cha.addDmgup( -6 );
                cha.addHitup( -3 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconAura( 162, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.BLESS_WEAPON )
            { // ブレス ウェポン
                cha.addDmgup( -2 );
                cha.addHitup( -2 );
                cha.addBowHitup( -2 );
            }
            else if ( skillId == L1SkillId.WIND_SHOT )
            { // ウィンド ショット
                cha.addBowHitup( -6 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconAura( 148, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.STORM_EYE )
            { // ストーム アイ
                cha.addBowHitup( -2 );
                cha.addBowDmgup( -3 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconAura( 155, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.STORM_SHOT )
            { // ストーム ショット
                cha.addBowDmgup( -5 );
                cha.addBowHitup( 1 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconAura( 165, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.BERSERKERS )
            { // バーサーカー
                cha.addAc( -10 );
                cha.addDmgup( -5 );
                cha.addHitup( -2 );
            }
            else if ( skillId == L1SkillId.SHAPE_CHANGE )
            { // シェイプ チェンジ
                L1PolyMorph.undoPoly( cha );
            }
            else if ( skillId == L1SkillId.ADVANCE_SPIRIT )
            { // アドバンスド スピリッツ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addMaxHp( -pc.getAdvenHp() );
                    pc.addMaxMp( -pc.getAdvenMp() );
                    pc.setAdvenHp( 0 );
                    pc.setAdvenMp( 0 );
                    pc
                            .sendPackets( new S_HPUpdate( pc.getCurrentHp(), pc
                                    .getMaxHp() ) );
                    if ( pc.isInParty() )
                    { // パーティー中
                        pc.getParty().updateMiniHP( pc );
                    }
                    pc
                            .sendPackets( new S_MPUpdate( pc.getCurrentMp(), pc
                                    .getMaxMp() ) );
                }
            }
            else if ( skillId == L1SkillId.HASTE || skillId == L1SkillId.GREATER_HASTE )
            { // ヘイスト、グレーターヘイスト
                cha.setMoveSpeed( 0 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillHaste( pc.getId(), 0, 0 ) );
                    pc.broadcastPacket( new S_SkillHaste( pc.getId(), 0, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.HOLY_WALK || skillId == L1SkillId.MOVING_ACCELERATION
                  || skillId == L1SkillId.WIND_WALK || skillId == L1SkillId.BLOODLUST )
            { // ホーリーウォーク、ムービングアクセレーション、ウィンドウォーク、ブラッドラスト
                cha.setBraveSpeed( 0 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillBrave( pc.getId(), 0, 0 ) );
                    pc.broadcastPacket( new S_SkillBrave( pc.getId(), 0, 0 ) );
                }
            }
            else if ( skillId == L1SkillId.ILLUSION_OGRE )
            { // イリュージョン：オーガ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addDmgup( -4 );
                    pc.addHitup( -4 );
                    pc.addBowDmgup( -4 );
                    pc.addBowHitup( -4 );
                }
            }
            else if ( skillId == L1SkillId.ILLUSION_LICH )
            { // イリュージョン：リッチ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addSp( -2 );
                    pc.sendPackets( new S_SPMR( pc ) );
                }
            }
            else if ( skillId == L1SkillId.ILLUSION_DIA_GOLEM )
            { // イリュージョン：ダイアモンドゴーレム
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addAc( 20 );
                }
            }
            else if ( skillId == L1SkillId.ILLUSION_AVATAR )
            { // イリュージョン：アバター
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addDmgup( -10 );
                    pc.addBowDmgup( -10 );
                }
            }
            else if ( skillId == L1SkillId.INSIGHT )
            { // インサイト
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addStr( (sbyte)-1 );
                    pc.addCon( (sbyte)-1 );
                    pc.addDex( (sbyte)-1 );
                    pc.addWis( (sbyte)-1 );
                    pc.addInt( (sbyte)-1 );
                }
            }

          // ****** 状態変化が解けた場合
            else if ( skillId == L1SkillId.CURSE_BLIND || skillId == L1SkillId.DARKNESS )
            {
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_CurseBlind( 0 ) );
                }
            }
            else if ( skillId == L1SkillId.CURSE_PARALYZE )
            { // カーズ パラライズ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_Poison( pc.getId(), 0 ) );
                    pc.broadcastPacket( new S_Poison( pc.getId(), 0 ) );
                    pc.sendPackets( new S_Paralysis( S_Paralysis.TYPE_PARALYSIS,
                            false ) );
                }
            }
            else if ( skillId == L1SkillId.WEAKNESS )
            { // ウィークネス
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addDmgup( 5 );
                    pc.addHitup( 1 );
                }
            }
            else if ( skillId == L1SkillId.DISEASE )
            { // ディジーズ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addDmgup( 6 );
                    pc.addAc( -12 );
                }
            }
            else if ( skillId == L1SkillId.ICE_LANCE // アイスランス
                  || skillId == L1SkillId.FREEZING_BLIZZARD // フリージングブリザード
                  || skillId == L1SkillId.FREEZING_BREATH )
            { // フリージングブレス
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_Poison( pc.getId(), 0 ) );
                    pc.broadcastPacket( new S_Poison( pc.getId(), 0 ) );
                    pc.sendPackets( new S_Paralysis( S_Paralysis.TYPE_FREEZE, false ) );
                }
                else if ( cha is L1MonsterInstance
                      || cha is L1SummonInstance
                      || cha is L1PetInstance )
                {
                    L1NpcInstance npc = (L1NpcInstance)cha;
                    npc.broadcastPacket( new S_Poison( npc.getId(), 0 ) );
                    npc.setParalyzed( false );
                }
            }
            else if ( skillId == L1SkillId.EARTH_BIND )
            { // アースバインド
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_Poison( pc.getId(), 0 ) );
                    pc.broadcastPacket( new S_Poison( pc.getId(), 0 ) );
                    pc.sendPackets( new S_Paralysis( S_Paralysis.TYPE_FREEZE, false ) );
                }
                else if ( cha is L1MonsterInstance
                      || cha is L1SummonInstance
                      || cha is L1PetInstance )
                {
                    L1NpcInstance npc = (L1NpcInstance)cha;
                    npc.broadcastPacket( new S_Poison( npc.getId(), 0 ) );
                    npc.setParalyzed( false );
                }
            }
            else if ( skillId == L1SkillId.SHOCK_STUN )
            { // ショック スタン
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_Paralysis( S_Paralysis.TYPE_STUN, false ) );
                }
                else if ( cha is L1MonsterInstance
                      || cha is L1SummonInstance
                      || cha is L1PetInstance )
                {
                    L1NpcInstance npc = (L1NpcInstance)cha;
                    npc.setParalyzed( false );
                }
            }
            else if ( skillId == L1SkillId.FOG_OF_SLEEPING )
            { // フォグ オブ スリーピング
                cha.setSleeped( false );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_Paralysis( S_Paralysis.TYPE_SLEEP, false ) );
                    pc.sendPackets( new S_OwnCharStatus( pc ) );
                }
            }
            else if ( skillId == L1SkillId.ABSOLUTE_BARRIER )
            { // アブソルート バリア
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.startHpRegeneration();
                    pc.startMpRegeneration();
                    pc.startMpRegenerationByDoll();
                }
            }
            else if ( skillId == L1SkillId.WIND_SHACKLE )
            { // ウィンド シャックル
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconWindShackle( pc.getId(), 0 ) );
                }
            }
            else if ( skillId == L1SkillId.SLOW || skillId == L1SkillId.ENTANGLE
                  || skillId == L1SkillId.MASS_SLOW )
            { // スロー、エンタングル、マススロー
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillHaste( pc.getId(), 0, 0 ) );
                    pc.broadcastPacket( new S_SkillHaste( pc.getId(), 0, 0 ) );
                }
                cha.setMoveSpeed( 0 );
            }
            else if ( skillId == L1SkillId.STATUS_FREEZE )
            { // Freeze
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_Paralysis( S_Paralysis.TYPE_BIND, false ) );
                }
                else if ( cha is L1MonsterInstance
                      || cha is L1SummonInstance
                      || cha is L1PetInstance )
                {
                    L1NpcInstance npc = (L1NpcInstance)cha;
                    npc.setParalyzed( false );
                }
            }
            else if ( skillId == L1SkillId.GUARD_BRAKE )
            { // ガードブレイク
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addAc( -15 );
                }
            }
            else if ( skillId == L1SkillId.HORROR_OF_DEATH )
            { // ホラーオブデス
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addStr( 5 );
                    pc.addInt( 5 );
                }
            }
            else if ( skillId == L1SkillId.STATUS_CUBE_IGNITION_TO_ALLY )
            { // キューブ[イグニション]：味方
                cha.addFire( -30 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_OwnCharAttrDef( pc ) );
                }
            }
            else if ( skillId == L1SkillId.STATUS_CUBE_QUAKE_TO_ALLY )
            { // キューブ[クエイク]：味方
                cha.addEarth( -30 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_OwnCharAttrDef( pc ) );
                }
            }
            else if ( skillId == L1SkillId.STATUS_CUBE_SHOCK_TO_ALLY )
            { // キューブ[ショック]：味方
                cha.addWind( -30 );
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_OwnCharAttrDef( pc ) );
                }
            }
            else if ( skillId == L1SkillId.STATUS_CUBE_IGNITION_TO_ENEMY )
            { // キューブ[イグニション]：敵
            }
            else if ( skillId == L1SkillId.STATUS_CUBE_QUAKE_TO_ENEMY )
            { // キューブ[クエイク]：敵
            }
            else if ( skillId == L1SkillId.STATUS_CUBE_SHOCK_TO_ENEMY )
            { // キューブ[ショック]：敵
            }
            else if ( skillId == L1SkillId.STATUS_MR_REDUCTION_BY_CUBE_SHOCK )
            { // キューブ[ショック]によるMR減少
                // cha.addMr(10);
                // if (cha is L1PcInstance) {
                // L1PcInstance pc = (L1PcInstance) cha;
                // pc.sendPackets(new S_SPMR(pc));
                // }
            }
            else if ( skillId == L1SkillId.STATUS_CUBE_BALANCE )
            { // キューブ[バランス]
            }

          // ****** アイテム関係
            else if ( skillId == L1SkillId.STATUS_BRAVE || skillId == L1SkillId.STATUS_ELFBRAVE )
            { // ブレイブポーション等
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillBrave( pc.getId(), 0, 0 ) );
                    pc.broadcastPacket( new S_SkillBrave( pc.getId(), 0, 0 ) );
                }
                cha.setBraveSpeed( 0 );
            }
            else if ( skillId == L1SkillId.STATUS_RIBRAVE )
            { // ユグドラの実
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    // XXX ユグドラの実のアイコンを消す方法が不明
                }
                cha.setBraveSpeed( 0 );
            }
            else if ( skillId == L1SkillId.STATUS_HASTE )
            { // グリーン ポーション
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillHaste( pc.getId(), 0, 0 ) );
                    pc.broadcastPacket( new S_SkillHaste( pc.getId(), 0, 0 ) );
                }
                cha.setMoveSpeed( 0 );
            }
            else if ( skillId == L1SkillId.STATUS_BLUE_POTION )
            { // ブルー ポーション
            }
            else if ( skillId == L1SkillId.STATUS_UNDERWATER_BREATH )
            { // エヴァの祝福＆マーメイドの鱗
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_SkillIconBlessOfEva( pc.getId(), 0 ) );
                }
            }
            else if ( skillId == L1SkillId.STATUS_WISDOM_POTION )
            { // ウィズダム ポーション
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    cha.addSp( -2 );
                    pc.sendPackets( new S_SkillIconWisdomPotion( 0 ) );
                }
            }
            else if ( skillId == L1SkillId.STATUS_CHAT_PROHIBITED )
            { // チャット禁止
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_ServerMessage( 288 ) ); // チャットができるようになりました。
                }
            }

          // ****** 毒関係
            else if ( skillId == L1SkillId.STATUS_POISON )
            { // ダメージ毒
                cha.curePoison();
            }

            // ****** 料理関係
            else if ( skillId == L1SkillId.COOKING_1_0_N || skillId == L1SkillId.COOKING_1_0_S )
            { // フローティングアイステーキ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addWind( -10 );
                    pc.addWater( -10 );
                    pc.addFire( -10 );
                    pc.addEarth( -10 );
                    pc.sendPackets( new S_OwnCharAttrDef( pc ) );
                    pc.sendPackets( new S_PacketBox( 53, 0, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_1_1_N || skillId == L1SkillId.COOKING_1_1_S )
            { // ベアーステーキ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addMaxHp( -30 );
                    pc.sendPackets( new S_HPUpdate( pc.getCurrentHp(),
                            pc.getMaxHp() ) );
                    if ( pc.isInParty() )
                    { // パーティー中
                        pc.getParty().updateMiniHP( pc );
                    }
                    pc.sendPackets( new S_PacketBox( 53, 1, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_1_2_N || skillId == L1SkillId.COOKING_1_2_S )
            { // ナッツ餅
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_PacketBox( 53, 2, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_1_3_N || skillId == L1SkillId.COOKING_1_3_S )
            { // 蟻脚のチーズ焼き
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addAc( 1 );
                    pc.sendPackets( new S_PacketBox( 53, 3, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_1_4_N || skillId == L1SkillId.COOKING_1_4_S )
            { // フルーツサラダ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addMaxMp( -20 );
                    pc.sendPackets( new S_MPUpdate( pc.getCurrentMp(),
                            pc.getMaxMp() ) );
                    pc.sendPackets( new S_PacketBox( 53, 4, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_1_5_N || skillId == L1SkillId.COOKING_1_5_S )
            { // フルーツ甘酢あんかけ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_PacketBox( 53, 5, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_1_6_N || skillId == L1SkillId.COOKING_1_6_S )
            { // 猪肉の串焼き
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addMr( -5 );
                    pc.sendPackets( new S_SPMR( pc ) );
                    pc.sendPackets( new S_PacketBox( 53, 6, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_1_7_N || skillId == L1SkillId.COOKING_1_7_S )
            { // キノコスープ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_PacketBox( 53, 7, 0 ) );
                    pc.setDessertId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_2_0_N || skillId == L1SkillId.COOKING_2_0_S )
            { // キャビアカナッペ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_PacketBox( 53, 8, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_2_1_N || skillId == L1SkillId.COOKING_2_1_S )
            { // アリゲーターステーキ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addMaxHp( -30 );
                    pc.sendPackets( new S_HPUpdate( pc.getCurrentHp(),
                            pc.getMaxHp() ) );
                    if ( pc.isInParty() )
                    { // パーティー中
                        pc.getParty().updateMiniHP( pc );
                    }
                    pc.addMaxMp( -30 );
                    pc.sendPackets( new S_MPUpdate( pc.getCurrentMp(),
                            pc.getMaxMp() ) );
                    pc.sendPackets( new S_PacketBox( 53, 9, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_2_2_N || skillId == L1SkillId.COOKING_2_2_S )
            { // タートルドラゴンの菓子
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addAc( 2 );
                    pc.sendPackets( new S_PacketBox( 53, 10, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_2_3_N || skillId == L1SkillId.COOKING_2_3_S )
            { // キウィパロット焼き
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_PacketBox( 53, 11, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_2_4_N || skillId == L1SkillId.COOKING_2_4_S )
            { // スコーピオン焼き
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_PacketBox( 53, 12, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_2_5_N || skillId == L1SkillId.COOKING_2_5_S )
            { // イレッカドムシチュー
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addMr( -10 );
                    pc.sendPackets( new S_SPMR( pc ) );
                    pc.sendPackets( new S_PacketBox( 53, 13, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_2_6_N || skillId == L1SkillId.COOKING_2_6_S )
            { // クモ脚の串焼き
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addSp( -1 );
                    pc.sendPackets( new S_SPMR( pc ) );
                    pc.sendPackets( new S_PacketBox( 53, 14, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_2_7_N || skillId == L1SkillId.COOKING_2_7_S )
            { // クラブスープ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_PacketBox( 53, 15, 0 ) );
                    pc.setDessertId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_3_0_N || skillId == L1SkillId.COOKING_3_0_S )
            { // クラスタシアンのハサミ焼き
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_PacketBox( 53, 16, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_3_1_N || skillId == L1SkillId.COOKING_3_1_S )
            { // グリフォン焼き
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addMaxHp( -50 );
                    pc.sendPackets( new S_HPUpdate( pc.getCurrentHp(),
                            pc.getMaxHp() ) );
                    if ( pc.isInParty() )
                    { // パーティー中
                        pc.getParty().updateMiniHP( pc );
                    }
                    pc.addMaxMp( -50 );
                    pc.sendPackets( new S_MPUpdate( pc.getCurrentMp(),
                            pc.getMaxMp() ) );
                    pc.sendPackets( new S_PacketBox( 53, 17, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_3_2_N || skillId == L1SkillId.COOKING_3_2_S )
            { // コカトリスステーキ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_PacketBox( 53, 18, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_3_3_N || skillId == L1SkillId.COOKING_3_3_S )
            { // タートルドラゴン焼き
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addAc( 3 );
                    pc.sendPackets( new S_PacketBox( 53, 19, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_3_4_N || skillId == L1SkillId.COOKING_3_4_S )
            { // レッサードラゴンの手羽先
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addMr( -15 );
                    pc.sendPackets( new S_SPMR( pc ) );
                    pc.addWind( -10 );
                    pc.addWater( -10 );
                    pc.addFire( -10 );
                    pc.addEarth( -10 );
                    pc.sendPackets( new S_OwnCharAttrDef( pc ) );
                    pc.sendPackets( new S_PacketBox( 53, 20, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_3_5_N || skillId == L1SkillId.COOKING_3_5_S )
            { // ドレイク焼き
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addSp( -2 );
                    pc.sendPackets( new S_SPMR( pc ) );
                    pc.sendPackets( new S_PacketBox( 53, 21, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_3_6_N || skillId == L1SkillId.COOKING_3_6_S )
            { // 深海魚のシチュー
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.addMaxHp( -30 );
                    pc.sendPackets( new S_HPUpdate( pc.getCurrentHp(),
                            pc.getMaxHp() ) );
                    if ( pc.isInParty() )
                    { // パーティー中
                        pc.getParty().updateMiniHP( pc );
                    }
                    pc.sendPackets( new S_PacketBox( 53, 22, 0 ) );
                    pc.setCookingId( 0 );
                }
            }
            else if ( skillId == L1SkillId.COOKING_3_7_N || skillId == L1SkillId.COOKING_3_7_S )
            { // バシリスクの卵スープ
                if ( cha is L1PcInstance )
                {
                    L1PcInstance pc = (L1PcInstance)cha;
                    pc.sendPackets( new S_PacketBox( 53, 23, 0 ) );
                    pc.setDessertId( 0 );
                }
            }

            if ( cha is L1PcInstance )
            {
                L1PcInstance pc = (L1PcInstance)cha;
                sendStopMessage( pc, skillId );
                pc.sendPackets( new S_OwnCharStatus( pc ) );
            }
        }

        // メッセージの表示（終了するとき）
        private static void sendStopMessage( L1PcInstance charaPc, int skillid )
        {
            L1Skills l1skills = SkillsTable.getInstance().getTemplate( skillid );
            if ( l1skills == null || charaPc == null )
            {
                return;
            }

            int msgID = l1skills.getSysmsgIdStop();
            if ( msgID > 0 )
            {
                charaPc.sendPackets( new S_ServerMessage( msgID ) );
            }
        }
    }
}